package IO流;

import java.io.UnsupportedEncodingException;

/**
 * 字符字节
 * 编码操作
 * */
public class File04Encode {


    public static void main(String[] args) throws UnsupportedEncodingException {
        String msg = "哈哈哈哈s";
        //编码默认当前（UTF—8）汉字三个。字母一个，结果13
        byte[] data = msg.getBytes();
         System.out.println(data.length);

         //编码：其他字符集
        //都是两个，结果10
        data = msg.getBytes("UTF_16LE");
        System.out.println(data.length);

        //汉字2个。字母1个，结果9
        data = msg.getBytes("GBK");
        System.out.println(data.length);



    }
}
